package com.zzy.web.controller.order;

import com.zzy.common.core.domain.AjaxResult;
import com.zzy.system.domain.GuanmaiSupplier;
import com.zzy.system.service.IPushDataService;
import com.zzy.system.service.ISaleOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 登录验证
 * 
 * @author zzy
 */
@Api(value = "Order", tags = {"销售订单"}, hidden = false)
@RestController
public class PushDataController
{
    @Autowired
    private IPushDataService iPushDataService;

    @GetMapping("/pushSupplier")
    @ApiOperation("推送供应商到溯源平台")
    public AjaxResult pushSupplier() throws Exception {
        AjaxResult ajax = AjaxResult.success();
        //iPushDataService.pushSpuToShanshengxian();
        GuanmaiSupplier guanmaiSupplier=new GuanmaiSupplier();
        iPushDataService.pushSupplier(guanmaiSupplier);
        return ajax;
    }
    @GetMapping("/pushCustomer")
    @ApiOperation("推送商户到溯源平台")
    public AjaxResult pushCustomer() throws Exception {
        AjaxResult ajax = AjaxResult.success();
        //iPushDataService.pushSpuToShanshengxian();
        iPushDataService.pushCustomer(null);
        return ajax;
    }
    @GetMapping("/getSupplierFromChongqing")
    @ApiOperation("从溯源平台获取供应商id")
    public AjaxResult getSupplierFromChongqing() throws Exception {
        AjaxResult ajax = AjaxResult.success();
        //iPushDataService.pushSpuToShanshengxian();
        GuanmaiSupplier guanmaiSupplier=new GuanmaiSupplier();
        guanmaiSupplier.setSupplierName("重庆恒焱食品有限公司");
        iPushDataService.getChongqingSupplier(guanmaiSupplier);
        return ajax;
    }
    @GetMapping("/getCustomerFromChongqing")
    @ApiOperation("从溯源平台获取商户id")
    public AjaxResult getCustomerFromChongqing() throws Exception {
        AjaxResult ajax = AjaxResult.success();
        //iPushDataService.pushSpuToShanshengxian();
        iPushDataService.getCustomerFromChongqing();
        return ajax;
    }
    @GetMapping("/pushSpu")
    @ApiOperation("推送产品信息到重庆溯源平台")
    public AjaxResult pushSpu() throws Exception {
        AjaxResult ajax = AjaxResult.success();
        //iPushDataService.pushSpuToShanshengxian();
        iPushDataService.pushSpu(null);
        return ajax;
    }

    @GetMapping("/pushPreInStockOrder")
    @ApiOperation("推送采购入库到溯源平台")
    public AjaxResult pushPreInStockOrder() throws Exception {
        AjaxResult ajax = AjaxResult.success();
        iPushDataService.pushInStockOrder();
        return ajax;
    }

    @GetMapping("/pushSaleOrder")
    @ApiOperation("推送销售出库单到陕生鲜")
    public AjaxResult pushSaleOrder() throws Exception {
        AjaxResult ajax = AjaxResult.success();
        iPushDataService.pushSaleOrder();
        return ajax;
    }
    @GetMapping("/pushPurchaseRefund")
    @ApiOperation("推送清库数据到重庆")
    public AjaxResult pushPurchaseRefund() throws Exception {
        AjaxResult ajax = AjaxResult.success();
        iPushDataService.pushPurchaseRefund();
        return ajax;
    }
}
